package cn.glc.daily.life.config.shiro;

import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.SimpleCredentialsMatcher;

/**
 * 自定义校验规则
 *
 * @author simon
 * @date 2020/9/20 16:43
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
public class CustomHashedCredentialsMatcher extends SimpleCredentialsMatcher {

    @Override
    public boolean doCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) {
        String accessToken = String.valueOf(token.getPrincipal());
        String validToken = String.valueOf(info.getCredentials());
        return accessToken.equals(validToken);
    }
}
